import { Component, OnInit, ViewChild, ViewContainerRef, ComponentRef, ComponentFactoryResolver, EventEmitter } from '@angular/core';
import * as _ from 'lodash';
import { ReviewPageComponent } from "../../content/review-page/review-page.component";
@Component({
  selector: 'app-review',
  templateUrl: './review.component.html',
  styleUrls: ['./review.component.scss']
})
export class ReviewComponent implements OnInit {

  // 模版
  @ViewChild("nqdiiReviewPage", { read: ViewContainerRef })
  nqdiiReviewPage: ViewContainerRef;
  reviewPageComponent: ComponentRef<ReviewPageComponent>;
  constructor(
    public resolver: ComponentFactoryResolver,
  ) { }

  ngOnInit() {
    if (this.reviewPageComponent && this.reviewPageComponent.instance) {
      this.reviewPageComponent.destroy();
    }
    const reviewPageComponent = this.resolver.resolveComponentFactory(ReviewPageComponent);
    this.reviewPageComponent = this.nqdiiReviewPage.createComponent(reviewPageComponent);
  }

}
